From: Zoltan Herczeg Date: Thu, 21 May 2026 03:56:00 +0000 (+0200) Subject: Backport of pcre2-10.48-Fix-JIT-STR_END.patch X-Git-Tag: archive/raspbian/10.46-1_deb13u2+rpi1^2~7 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=4c5447960d8df0d951d9b8f08296c146d0033eaa;p=pcre2.git Backport of pcre2-10.48-Fix-JIT-STR_END.patch Cherry-pick of ff92e0b9cea5b5ae3af12ba930d03556684f098b Fix setting STR_END in JIT (#912) When OP_VREVERSE is present in a non-atomic LOOKBEHIND ASSERTION, the STR_END must be set before the backtracking path is executed. (cherry picked from commit 0aa5bbca3ac70e6c22562488ead6cb2032447fc5) --- diff --git a/src/pcre2_jit_compile.c b/src/pcre2_jit_compile.c index 90592c1..48a0b3e 100644 --- a/src/pcre2_jit_compile.c +++ b/src/pcre2_jit_compile.c @@ -12231,6 +12231,8 @@ else if (SLJIT_UNLIKELY(opcode == OP_ASSERT_SCS)) if (common->restore_end_ptr == 0) common->restore_end_ptr = private_data_ptr + sizeof(sljit_sw); } +else if (SLJIT_UNLIKELY(opcode == OP_ASSERTBACK_NA) && PRIVATE_DATA(ccbegin + 1)) + OP1(SLJIT_MOV, STR_END, 0, SLJIT_MEM1(SLJIT_SP), private_data_ptr); if (SLJIT_UNLIKELY(opcode == OP_ONCE)) { diff --git a/src/pcre2_jit_test.c b/src/pcre2_jit_test.c index b336abe..8344c44 100644 --- a/src/pcre2_jit_test.c +++ b/src/pcre2_jit_test.c @@ -652,6 +652,7 @@ static struct regression_test_case regression_test_cases[] = { { MU, A, 0, 0, "a(?=)b", "ab" }, { MU, A, 0, 0 | F_NOMATCH, "a(?!)b", "ab" }, { MU, A, 0, 0, "(?(?